<?php
#
#
# Copyright TEDECO, 2009. http://tedeco.fi.upm.es
#
# This file is part of kumenya.
#
# Kumenya is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Kumenya is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
#
#
#
?>
<?php
	include("../commons/clases.php");
	include("../commons/www.php");
	include(Accion . "marks_list_aux.php");

    // Editable variables.
    $Host = "localhost";
    $User = "kumenyaapp";
    $Password = "EfJ7i49c3v11";
    $DBName = "kumenya_matriculacion";
    $DBName2 = "kumenya_biblioteca";
    $select_user = "SELECT Persona FROM usuarios WHERE Uid = ".$_SESSION[Usuario];
    // End editable variables.
    
    // Connect to DB
    $link = mysql_connect ($Host, $User, $Password) or die('Could not connect: ' . mysql_error());
    
    // Search teacher identifier
    mysql_select_db($DBName2) or die('Could not select database');
    $result = mysql_query($select_user);
    $row = mysql_fetch_row($result);
    $teacher_id = (string)(int)$row[0];
    
    // Start Interface
	Interfaz::Cabecera(_("Marks") . " " . _("List"));

	Interfaz::AbrirCuerpo(FALSE);

    Interfaz::Formulario (Pagina. "marks_list_query.php");

	Interfaz::Botones ();
	Interfaz::BotonDeEnvio (_("Consult"), FALSE);
	Interfaz::CerrarBotones ();

    // Fill careers combobox.
    $select_subjects = "SELECT asignaturas.NombreAsignatura, asignaturas.Uid FROM (((personas RIGHT JOIN profesores ON profesores.Uid = personas.Uid) RIGHT JOIN asignaturasprofesores on asignaturasprofesores.UidProfesor = profesores.Uid) RIGHT JOIN asignaturas ON asignaturas.Uid = asignaturasprofesores.UidAsignatura) WHERE personas.Uid = ".$teacher_id;    
    mysql_select_db($DBName) or die('Could not select database');
    $result = mysql_query($select_subjects);
    echo '<label for="subject">Subject : </label>';
    echo '<select name="subject" size="1">';  
    while($row = mysql_fetch_row($result))
    {
        echo '<option value="'.$row[1].'">'.$row[0].'</option>';  
    }  
    echo '</select><br />';  
    
    // Year
    echo '
    <label for="year">Year : </label>
    <input type="text" name="year" maxlength="4"/><br />';

    // Session
    echo '
    <label for="convocatory">Convocatory : </label>
    <select name="convocatory" size="1">  
        <option value="NotaPrimera">February</option>  
        <option value="NotaSegunda">June</option>  
        <option value="NotaExtraordinaria">Extraordinary</option>  
        <option value="NotaFinal">Final</option>
    </select><br />';  
    
    mysql_close($link);
	Interfaz::CerrarFormulario();

   	Interfaz::Fin(FALSE);
?>
